home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-03-16 | 3.3 KB | 110 lines | [TEXT/KAHL] |
- /************************************************************
- *
- *
- * Header containing local code definitions.
- *
- * by Adrian Bool in cooperation with Graham Cox.
- *
- * copyright © phantasm coding 1992.
- *
- *
- ************************************************************/
-
- /* private functions */
-
- void makeMemoryInstruction(opcode , rBlock,pHandle);
- short thisPage(pHandle);
- short pageOf(addressType);
- addressType evaluateAddress(pHandle , char*);
- wordType evaluateValue(pHandle , char*);
- wordType evaluatePart(pHandle, char*);
- wordType htoi(char*);
- wordType otoi(char*);
-
- /* opcode functions */
-
- static short noOfOpcodes = 30;
-
- void cmpAND(short,rBlock,short*,pHandle); /* 7 basic opcode functions */
- void cmpTAD(short,rBlock,short*,pHandle);
- void cmpISZ(short,rBlock,short*,pHandle);
- void cmpDCA(short,rBlock,short*,pHandle);
- void cmpJMS(short,rBlock,short*,pHandle);
- void cmpJMP(short,rBlock,short*,pHandle);
- void cmpIO(short,rBlock,short*,pHandle);
-
- void cmpCLL(short,rBlock,short*,pHandle); /* 9 group one accumulator functions */
- void cmpCMA(short,rBlock,short*,pHandle);
- void cmpCML(short,rBlock,short*,pHandle);
- void cmpIAC(short,rBlock,short*,pHandle);
- void cmpRAR(short,rBlock,short*,pHandle);
- void cmpRAL(short,rBlock,short*,pHandle);
- void cmpRTR(short,rBlock,short*,pHandle);
- void cmpRTL(short,rBlock,short*,pHandle);
- void cmpNOP(short,rBlock,short*,pHandle);
-
- void cmpSMA(short,rBlock,short*,pHandle); /* 9 group two accumualator functions */
- void cmpSZA(short,rBlock,short*,pHandle);
- void cmpSNL(short,rBlock,short*,pHandle);
- void cmpSPA(short,rBlock,short*,pHandle);
- void cmpSNA(short,rBlock,short*,pHandle);
- void cmpSZL(short,rBlock,short*,pHandle);
- void cmpCLA(short,rBlock,short*,pHandle);
- void cmpOSR(short,rBlock,short*,pHandle);
- void cmpHLT(short,rBlock,short*,pHandle);
-
- void cmpORG(short,rBlock,short*,pHandle); /* 5 pseudo-operations' functions */
- void cmpEQU(short,rBlock,short*,pHandle);
- void cmpEND(short,rBlock,short*,pHandle);
- void cmpDATA(short,rBlock,short*,pHandle);
- void cmpSTORE(short,rBlock,short*,pHandle); /* total : 30 functions */
-
- /* opcode table */
-
- typedef char aMnemonic[8];
-
- typedef struct
- {
- aMnemonic mnemonic;
- wordType iNumber;
- void (*itsFunction)(short,rBlock,short*,pHandle);
- } anOpcode;
-
- static anOpcode pdp8[31] =
- { /* cmp is short for compile */
- {"nul", 0, nil},
-
- {"and", 0, &cmpAND}, /* 7 basic opcode types */
- {"tad", 1, &cmpTAD},
- {"isz", 2, &cmpISZ},
- {"dca", 3, &cmpDCA},
- {"jms", 4, &cmpJMS},
- {"jmp", 5, &cmpJMP},
- {"io", 6, &cmpIO},
-
- {"cll", 07100, &cmpCLL}, /* 9 group one accumulator types*/
- {"cma", 07040, &cmpCMA},
- {"cml", 07020, &cmpCML},
- {"iac", 07001, &cmpIAC},
- {"rar", 07010, &cmpRAR},
- {"ral", 07004, &cmpRAL},
- {"rtr", 07012, &cmpRTR},
- {"rtl", 07006, &cmpRTL},
- {"nop", 07000, &cmpNOP},
-
- {"sma", 07500, &cmpSMA}, /* 9 group two accumualator types */
- {"sza", 07440, &cmpSZA},
- {"snl", 07420, &cmpSNL},
- {"spa", 07510, &cmpSPA},
- {"sna", 07450, &cmpSNA},
- {"szl", 07430, &cmpSZL},
- {"cla", 07600, &cmpCLA},
- {"osr", 07404, &cmpOSR},
- {"hlt", 07402, &cmpHLT},
-
- {"org", 0, &cmpORG}, /* 5 pseudo-operations */
- {"equ", 0, &cmpEQU},
- {"end", 0, &cmpEND},
- {"data", 0, &cmpDATA},
- {"store", 0, &cmpSTORE}, /* total : 30 instructions */
- };